<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            border: 1px solid red
        }
        #d1{
            position: absolute;
            /*绝对定位默认是相对于窗口做位置偏移*/
            left: 30px;/*可以为负值*/
            bottom: 30px;
        }
        #big{width: 200px;height: 200px;background-color: green;
            margin: 100px 0 0 100px
        }
        #big>div{width: 100px;height: 100px;background-color: red;
            /*因为它上级的div有边框，所以不会发生外边距塌陷问题*/
            margin: 50px 0 0 50px;
            /*做参照物,加一个相对定位，则别的元素的绝对定位就是相对于此元素，要不然默认的是窗口*/
            position: relative;
        }
        #big>div>div{
            width: 50px;height: 50px;background-color: blue;
            position: absolute;
            left: 0px;
            top: 0px;
        }
    </style>
</head>
<body>
<div id="big">
    <div>
        <div></div>
    </div>
</div>
<div id="d1">div1</div>
<div>div2</div>
<div>div3</div>
</body>
</html>